#ifndef _BUTTON_H_
#define _BUTTON_H_

#include "render_target.h"
#include "sprite_sheet.h"
#include "event_target.h"
//#include "SDL.h"

class Button;
typedef void (*ButtonCallback)(void* obj, Button *button);

enum ButtonState {
	BUTTON_NORMAL,
	BUTTON_PRESSED,
	BUTTON_HOVER,
	BUTTON_DISABLED
};

class Button : public RenderTarget, public EventTarget
{
public:
	bool pressed;
	ButtonCallback callback;
	void *callbackObject;
	SpriteSheet *buttonSprite;
	ButtonState state;
	Button(std::string imageSet, ButtonCallback callbackFunc, void* callbackObj);
	SDLKey hotKey;

	bool IsOverlapping(int mX, int mY);
    bool OnLButtonDown(int mX, int mY);
    bool OnLButtonUp(int mX, int mY);
    bool OnMouseMove(int mX, int mY, int relX, int relY, bool Left,bool Right,bool Middle);
    bool OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode);
    bool OnKeyUp(SDLKey sym, SDLMod mod, Uint16 unicode);
	void SetEnabled(bool enable);
	bool GetEnabled();
	static void staticEnableButton(void *obj, Timer *timer);
};

#endif